package com.rybbaby.tss.platform.codeGenerate.service.imp;

import com.rybbaby.tss.core.bean.TableBean;
import com.rybbaby.tss.core.bean.TableColumnBean;
import com.rybbaby.tss.core.code.generate.config.GenerateConfig;
import com.rybbaby.tss.core.web.service.imp.BaseServiceImp;
import com.rybbaby.tss.platform.codeGenerate.dao.ICodeGenerateDao;
import com.rybbaby.tss.platform.codeGenerate.service.ICodeGenerateService;
import org.hibernate.mapping.Table;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.util.List;

/**
 * @description 代码生成器Service接口实现
 *
 * @author 谢进伟
 *
 * @createDate 2016年2月3日 下午9:15:17
 */
@Service
public class CodeGenerateServiceImp extends BaseServiceImp<Table> implements ICodeGenerateService {
	
	@Autowired
	private ICodeGenerateDao dao;
	
	@Override
	public List<TableColumnBean> getTableColumns(String catalog , String tableName) throws ClassNotFoundException , InstantiationException , IllegalAccessException , SQLException {
		return this.dao.getTableColumns(catalog , tableName);
	}
	
	@Override
	public void autoGenCode(GenerateConfig gc) throws ClassNotFoundException , InstantiationException , IllegalAccessException , SQLException {
		this.dao.autoGenCode(gc);
	}
	
	@Override
	public List<String> getAllCatalog() throws ClassNotFoundException , InstantiationException , IllegalAccessException , SQLException {
		return this.dao.getAllCatalog();
	}
	
	@Override
	public List<TableBean> getAllTable(String catalog) throws ClassNotFoundException , InstantiationException , IllegalAccessException , SQLException {
		return this.dao.getAllTable(catalog);
	}
	
	@Override
	public String getTableRemarks(String catalog , String tableName) throws Exception {
		return this.dao.getTableRemarks(catalog , tableName);
	}
	
}
